/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ParsingException.java
 *
 * Created on 23/Dez/2011, 16:46:31
 */

package intopo.evogame.partnerselection.config;

/**
 * This exception is thrown when a parsing error occured while reading a configuration file.
 * @author <a href="mailto:mariano.pedro@gmail.com">Pedro Mariano</a>
 *
 * @version 1.0 23/Dez/2011
 */
public class ParsingException
	extends Exception
{
	/**
	 * File contents if any.
	 */
	final private String contents;
	/**
	 * Creates a new instance of <code>ParsingException</code> without detail message.
	 */
	public ParsingException (String message)
	{
		this (message, null);
	}


	/**
	 * Constructs an instance of <code>ParsingException</code> with the specified detail message.
	 * @param msg the detail message.
	 */
	public ParsingException (String message, String contents)
	{
		super (message);
		this.contents = contents;
	}

	public String getContents ()
	{
		return this.contents;
	}
	public String getUserMessage ()
	{
		String message;
		message = "Error parsing configuration file";
		if (this.contents == null) {
			message += ".\nNo line available.";
		}
		else {
			message += " at line '" + this.contents + "'.";
		}
		message += "\n" + this.getLocalizedMessage ();
		return message;
	}
}

// Local Variables:
// mode: java
// mode: flyspell-prog
// ispell-local-dictionary: "british"
// End:
